import {post, get} from "./http";

//判断管理员是否登录成功
export const getLoginStatus = (username, password) => post('admin/login', {username, password});
//注册
export const getRegisterStatus = (username, password) => post('/admin/add', {username, password});
//查询所有用户
export const getConsumer = (pageNum, pageSize, username) => get('/consumer/page', {pageNum, pageSize, username})
//查询需要审批的用户
export const getConsumerType = (pageNum, pageSize) => get('/consumer/changeType', {pageNum, pageSize})
//查询所有用户不分页
export const getAllConsumers = () => get('/consumer/userAll')

//编辑
export const updateConsumer = (consumer) => post('/consumer/update', consumer)
// 删除用户
export const deleteConsumer = (id) => get(`consumer/delete`, {id})
//批量删除用户
export const deleteConsumers = (ids) => post(`consumer/delBatch`, ids)
// 上传用户头像
export const uploadAvatar = (payload) => post(`admin/upload`, payload, {
  headers: {'Content-Type': 'multipart/form-data'}, cache: false,
  contentType: false,
  processData: false,
})
//修改密码
export const updatePwd = (payload) => post(`/admin/updatePassword`, payload)


//根据用户id查找自己上传的歌曲
export const songOfConsumerId = (pageNum, pageSize, name, consumerId) => get(`/staff/page`, {
  pageNum,
  pageSize,
  name,
  consumerId
})
//编辑
export const updateStaff = (staff) => post('/staff/update', staff)
// 删除乐谱
export const deleteStaff = (id) => get(`staff/delete`, {id})
//批量删除乐谱
export const deleteStaffs = (ids) => post(`staff/delBatch`, ids)
//查询用户、乐谱集、乐谱总数
export const getAllCounts= () => get('/staff/findStaffs')
//查询不同风格的乐谱集下的乐谱总数
export const getStyle1Staff= () => get('/StyleStaff')
//修改乐谱状态——审批
export const changeType= (staffId,type) => get('/staff/updateStaffType',{staffId,type})

//乐谱集
//查看所有分类
export const getStaffsList = (pageNum, pageSize, style) => get('/page', {pageNum, pageSize, style})
//编辑
export const updateStaffsList = (staff) => post('/update', staff)
// 删除乐谱集
export const deleteStaffsList = (id) => get(`/delete`, {id})
//批量删除乐谱集
export const deleteStaffsLists = (ids) => post(`/delBatch`, ids)
//新增乐谱集
export const addStaffsList = (staff) => post(`/add`, staff, {
  headers:{
    'content-type':'multipart/form-data'
  }
})
//根据乐谱集id查询乐谱
export const StaffListOfStaffListId = (pageNum, pageSize,staffListId,name) => get(`staff/staffPage`,{
  pageNum,
  pageSize,
  staffListId,
  name
})

//收藏
//收藏列表根据用户id查询
export const getCollectOfStaff = (pageNum, pageSize, consumerId,name) =>get(`/staff/likeStaffPage`,{pageNum, pageSize, consumerId,name})
//收藏列表根据用户id查询
export const deleteCollect = (id) =>get(`/collect/delete`,{id})
//批量删除乐谱集
export const deleteCollectLists = (ids) => post(`/collect/delBatch`, ids)

//评论
//查询乐谱的所有评论
export const getAllComment = (staffId) => get(`comment/commentOfStaffId?staffId=${staffId}`)
//删除评论
export const deleteComment = (id) => get(`comment/delete?id=${id}`)
//批量删除评论
export const deleteComments = (ids) => post('/comment/delBatch', ids)
//编辑
export const updateComment = (comment) => post('/comment/updateComment', comment)




